/*
 * @(#)EventServiceImp.java
 * Copyright (c) 2011 TravelSky Technology Ltd. All Right Reserved. 
 */
package com.meetingshow.privilege.service;

import java.util.ArrayList;
import java.util.List;    
    
import com.meetingshow.common.base.dao.model.QueryStruct;
import com.meetingshow.common.base.service.BaseServiceImp;
import com.meetingshow.common.base.service.model.QueryResults;
import com.meetingshow.privilege.dao.EventDAO;
import com.meetingshow.privilege.dao.model.EventPO;
import com.meetingshow.privilege.service.model.EventQueryParas;
import com.meetingshow.privilege.service.util.EventQueryParasBuilder;
import com.meetingshow.privilege.service.util.EventServiceParas;

public class EventServiceImp extends BaseServiceImp implements IEventService {

    private EventDAO eventDAO;
    
    public EventDAO getEventDAO() {
        return eventDAO;
    }

    public void setEventDAO(EventDAO eventDAO) {
        this.eventDAO = eventDAO;
    }
    
    @Override
    public EventPO getEventById (java.lang.Integer eventId) throws Exception {
        return getEventDAO().getEventById(eventId);
    }
    
    @Override
    public QueryResults<EventPO> queryEvent(EventQueryParas eventQueryParas)
            throws Exception {
        QueryStruct queryStruct = new QueryStruct();
        List<String> tableList = new ArrayList<String>();
        List<String> returnObjectList = new ArrayList<String>();
        
        tableList.add(EventServiceParas.EVENTPO);
        returnObjectList.add(EventServiceParas.EVENTPO);
        
        queryStruct.setTableList(tableList);
        queryStruct.setReturnObjectList(returnObjectList);
        
        queryStruct = EventQueryParasBuilder.eventQueryBuilder(queryStruct, eventQueryParas);
        QueryResults<EventPO> queryResults = getEventDAO().queryEvent(queryStruct);
        return queryResults;
    }

    @Override
    public void removeEvent(EventPO eventPO) throws Exception {
        getEventDAO().removeEvent(eventPO);
    }

    @Override
    public void saveEvent(EventPO eventPO) throws Exception {
        getEventDAO().saveEvent(eventPO);
    }

    @Override
    public void updateEvent(EventPO eventPO) throws Exception {
        getEventDAO().updateEvent(eventPO);
    }

}